/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.crm.controller;

import queenb.web.controller.QueenbController;
import queenb.web.crm.inteface.N900Inf;
import queenb.web.crm.store.N900Store;

/**
 *
 * @author Nguyen Hung
 */
public class N900Controller extends QueenbController {

    private int pn850;
    private String nv851;
    private String nv852;
    private int fn100;
    private int pn100;
    private int fn850;
    private String nv901;
    private String nv902;
    private String nv903;
    private String nv904;
    private String hoten;
    private String label;
    private int val;
    private String val2;
    private N900Store n900Store;
    private N900Inf n900Inf;
    private String pageLoad;
    private int beginContructor;

    public N900Controller() {
        n900Store = new N900Store();

        Object objPn100 = getRequest().getParameter("pn100");
        System.out.println("-----pn100---"+objPn100);
        if (objPn100 != null) {
            pn100 = Integer.parseInt(objPn100.toString());

            System.out.println("-------pn1000----" + pn100);
        }
        Object objN850 = getRequest().getParameter("fn850");
        if (objN850 != null) {
            fn850 = Integer.parseInt(objN850.toString());
            System.out.println("-------fn850----" + fn850);
        }
        Object objPage = getRequest().getParameter("page");
        if (objPage != null) {
            pageLoad = objPage.toString();
        }
        Object objAction = getRequest().getParameter("action");
        if(objAction!=null){
            if(objAction.toString().equals("updateColumN900")){
                Object objNv902= getRequest().getParameter("nv902");
                if(objNv902 != null){
                    this.nv902 = objNv902.toString();
                }
                updateN900();
            }
        }
    }

    public void updateN900() {
        try {
            System.out.println("---yuodate ---"+this.getPn100()+","+this.getFn850()+","+ this.getNv901()+","+ this.getNv902()+","+ this.getNv903()+","+ this.getNv904()+","+ getLogin().getUserName());
            n900Store.updateN900(this.getPn100(), this.getFn850(), this.getNv901(), this.getNv902(), this.getNv903(), this.getNv904(), getLogin().getUserName());
            sendRedirect(pageLoad);
            //showGlobalReport(true, getResourceString("datasavesuccessful"));
            
        } catch (Exception ex) {
            showGlobalReport(true, getResourceString("datasuccessfail"));
             sendRedirect(pageLoad);
        }
    }

    /**
     * @return the pn850
     */
    public int getPn850() {
        return pn850;
    }

    /**
     * @param pn850 the pn850 to set
     */
    public void setPn850(int pn850) {
        this.pn850 = pn850;
    }

    /**
     * @return the nv851
     */
    public String getNv851() {
        return nv851;
    }

    /**
     * @param nv851 the nv851 to set
     */
    public void setNv851(String nv851) {
        this.nv851 = nv851;
    }

    /**
     * @return the nv852
     */
    public String getNv852() {
        return nv852;
    }

    /**
     * @param nv852 the nv852 to set
     */
    public void setNv852(String nv852) {
        this.nv852 = nv852;
    }

    /**
     * @return the fn100
     */
    public int getFn100() {
        return fn100;
    }

    /**
     * @param fn100 the fn100 to set
     */
    public void setFn100(int fn100) {
        this.fn100 = fn100;
    }

    /**
     * @return the pn100
     */
    public int getPn100() {
        return pn100;
    }

    /**
     * @param pn100 the pn100 to set
     */
    public void setPn100(int pn100) {
        this.pn100 = pn100;
    }

    /**
     * @return the fn850
     */
    public int getFn850() {
        return fn850;
    }

    /**
     * @param fn850 the fn850 to set
     */
    public void setFn850(int fn850) {
        this.fn850 = fn850;
    }

    /**
     * @return the nv901
     */
    public String getNv901() {
        return nv901;
    }

    /**
     * @param nv901 the nv901 to set
     */
    public void setNv901(String nv901) {
        this.nv901 = nv901;
    }

    /**
     * @return the hoten
     */
    public String getHoten() {
        return hoten;
    }

    /**
     * @param hoten the hoten to set
     */
    public void setHoten(String hoten) {
        this.hoten = hoten;
    }

    /**
     * @return the label
     */
    public String getLabel() {
        return label;
    }

    /**
     * @param label the label to set
     */
    public void setLabel(String label) {
        this.label = label;
    }

    /**
     * @return the val
     */
    public int getVal() {
        return val;
    }

    /**
     * @param val the val to set
     */
    public void setVal(int val) {
        this.val = val;
    }

    /**
     * @return the val2
     */
    public String getVal2() {
        return val2;
    }

    /**
     * @param val2 the val2 to set
     */
    public void setVal2(String val2) {
        this.val2 = val2;
    }

    /**
     * @return the nv902
     */
    public String getNv902() {
        return nv902;
    }

    /**
     * @param nv902 the nv902 to set
     */
    public void setNv902(String nv902) {
        this.nv902 = nv902;
    }

    /**
     * @return the nv903
     */
    public String getNv903() {
        return nv903;
    }

    /**
     * @param nv903 the nv903 to set
     */
    public void setNv903(String nv903) {
        this.nv903 = nv903;
    }

    /**
     * @return the nv904
     */
    public String getNv904() {
        return nv904;
    }

    /**
     * @param nv904 the nv904 to set
     */
    public void setNv904(String nv904) {
        this.nv904 = nv904;
    }

    /**
     * @return the n900Inf
     */
    public N900Inf getN900Inf() {
        return n900Inf;
    }

    /**
     * @param n900Inf the n900Inf to set
     */
    public void setN900Inf(N900Inf n900Inf) {
        this.n900Inf = n900Inf;
    }

    /**
     * @return the pageLoad
     */
    public String getPageLoad() {
        return pageLoad;
    }

    /**
     * @param pageLoad the pageLoad to set
     */
    public void setPageLoad(String pageLoad) {
        this.pageLoad = pageLoad;
    }

    /**
     * @return the beginContructor
     */
    public int getBeginContructor() {
        return beginContructor;
    }

    /**
     * @param beginContructor the beginContructor to set
     */
    public void setBeginContructor(int beginContructor) {
        this.beginContructor = beginContructor;
    }
}
